<template>
  <view class="goods_item">
    <view class="goods-img">
      <slot name="checkout"></slot>
      <image :src="goods.goods_small_logo||defaultPic" class="goods-pic"></image>
    </view>
    <view class="goods-text">
      <view class="goods-name"  @click="gotoDetail(goods)">{{goods.goods_name}}</view>
     
      <view class="goods-price-box">
        <view class="goods-price">￥{{goods.goods_price|filterNum}}</view>
        <slot name="number"></slot>
      </view>
    </view>
  </view>
</template>

<script>
  export default {
    name:"mygoods",
    props :{
      goods:{
        type:Object,
        default:{}
      }
    },
    data() {
      return {
         defaultPic:'../../static/Cache_-3ea2b366ff9ecbcc..jpg'
      };
    },
    methods:{
      gotoDetail(goods){
        // console.log(goods);
        uni.navigateTo({
          url:'/subpkg/goods_detail/goods_detail?goods_id='+goods.goods_id
        })
      }
    },
    filters:{
      filterNum(num){
        return Number(num).toFixed(2)
      }
    }
  }
</script>

<style lang="scss">
.goods_item {
  display: flex;
  padding: 10px 5px ;
  border-bottom:1px solid #efefef ;
  .goods-img {
    display: flex;
    justify-content: space-between;
    align-items: center;
   .goods-pic {
     height: 100px;
     width: 100px;
     display: block;
   }
  }
  .goods-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: space-between;
    margin-left: 5px;
    .goods-name {
      font-size: 12px
    }
    .goods-price-box {
      display: flex;
      justify-content: space-between;
      align-items: center;
      .goods-price {
        font-size: 13px;
        color: #C00000;
      }
    }
  }
}
</style>